// use ArrayList to store poles take_out/put_in from/to for each Hanoi moving step instead of using my IntStack

class cpoleFIFO {
  cpoleFIFO() {
    fifo = new ArrayList<cpole>();
  }

  void in(cpole pole) {
    fifo.add(pole);
  }

  cpole out() {
    cpole ret  = null;
    if (fifo.size() > 0) {
      ret = fifo.get(0);
      fifo.remove(0);
    }
    return ret;
  }

  void clear() {
    fifo.clear();
  }

  int size() {
    return fifo.size();
  }

  boolean isEmpty() {
    return (fifo.size() == 0);
  }

  boolean isNotEmpty() {
    return (fifo.size() != 0);
  }

  private ArrayList<cpole> fifo;
}
